﻿using System;
using System.Collections.Generic;
using System.Web;
using OneMG.Phoenix.Service.Model;
using OneMG.Phoenix.Service.Contracts;
using OneMG.Phoenix.Service;
using OneMG.Phoenix.Kernel.Util;

namespace OneMG.Phoenix.AdminSite.Views.Category
{

    public class Delete : IHttpHandler
    {
        ICategoryService ICategory = new CategoryService();

        public void ProcessRequest(HttpContext context)
        {
            if (string.IsNullOrEmpty(context.Request.Form["categoryID"]))
            {
                throw new Exception("类别ID不能为空");
            }

            int categoryID = int.Parse(context.Request.Form["categoryID"]);
            ICategory.DeleteByCategoryID(categoryID);

            JsonResult.Result(context, JsonMessageStatus.OK, "类目删除成功");

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
